<div class="row m-n">
    <div class="crumbs-bar">
        <div yb-crumbs></div>
    </div>
    <div tabset type="tab">
        <div tab heading="期初入库" active="activeFlag[0]" ng-click="changeTab(0)">
            <div class="row wrapper-y-sm">
                <div class="operate-bar col-xs-4 font-0">
                    <button class="btn btn-operate m-r-sm" ng-click="importData()"
                            ng-disabled="!btnPermission.beginningInImport" translate translate-attr-title="{{!btnPermission.beginningInImport?'无权限执行此操作':''}}">导入</button>
                </div>
                <div class="search-bar wrapper-none col-xs-8">
                    <div class="btn-group m-l-xs pull-right">
                        <button type="button" class="btn btn-default base-color" ng-click="search()" translate translate-attr-title="刷新">
                            <i class="yb-icon ico-refresh"></i>
                        </button>
                    </div>
                    <div class="input-group pull-right clearfix">
                      <input type="text" class="form-control txt-search" translate
                          translate-attr-placeholder="期初入库单号" ng-model="condition.billNo">
                      <span class="input-group-addon cursor-pointer" ng-click="search(1)" translate>搜索</span>
                  </div>
                </div>
            </div>
            <div class="main-area">
                <div yb-table-fixed class="table-fixed-wrap fix-left" ele-count="4" scroll-area="right">
                    <div class="th-fixed">
                        <table class="table-fixed border-none" width="{{tableConfig.fixedWidth}}">
                            <thead>
                            <tr>
                                <th ng-repeat="itemCol in tableConfig.tableCol track by $index" width="{{itemCol.width}}"
                                    ng-show="!!itemCol.isShow && !!itemCol.isFixed">
                                    <div yb-thead-operate ng-model="itemCol" target-width="tableConfig.fixedWidth" fixed-width="tbStyle.scrollLeft"></div>
                                </th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="th-scroll-x" ng-style="tbStyle.scrollLeft">
                        <table class="table-fixed border-none" width="{{tableConfig.scrollWidth}}">
                            <thead>
                            <tr>
                                <th ng-repeat="itemCol in tableConfig.tableCol track by $index" width="{{itemCol.width}}"
                                    ng-show="!!itemCol.isShow && !itemCol.isFixed">
                                    <div yb-thead-operate ng-model="itemCol" target-width="tableConfig.scrollWidth"></div>
                                </th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll-y" ng-show="dataList.length>0">
                        <table class="table-fixed border-none" width="{{tableConfig.fixedWidth}}">
                            <tbody>
                            <tr ng-repeat="item in dataList track by $index" ng-class="{'row-selected': $index === markInfo.curRow}"
                                ng-click="selectRow($index)">
                                <td class="spill-dots border-l-none" ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                    width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !!itemCol.isFixed"
                                    title="{{item[itemCol.dataField]}}">
                                    <span ng-if="!itemCol.clickFn && itemCol.type !== 'operate'">{{item[itemCol.dataField]}}</span>
                                    <a class="btn-operate m-r-xs" ng-click="tdClick($parent.$parent.$index, item, itemCol.clickFn)" ng-if="!!itemCol.clickFn">
                                        {{item[itemCol.dataField]}}
                                    </a>
                                    <div class="font-0" ng-if="itemCol.type === 'operate'">
                                        <button type="button" class="btn btn-operate m-r-xs" ng-click="printBill(item)"
                                                ng-disabled="!btnPermission.beginningInPrint" translate translate-attr-title="{{!btnPermission.beginningInPrint?'无权限执行此操作':''}}">打印</button>
                                        <button class="btn btn-operate m-r-xs" ng-click="inbound(item)" ng-if="curOrg.isBarcode === 0"
                                                ng-disabled="item.state !== 0 || !btnPermission.beginningInIn" translate translate-attr-title="{{!btnPermission.beginningInIn?'无权限执行此操作':''}}">入库</button>
                                        <button type="button" class="btn btn-operate m-r-xs" ng-click="mandatoryFinish(item.billNo)"
                                                ng-disabled="item.state == 2 || item.state == 3 || !btnPermission.mandatoryFinish" translate translate-attr-title="{{!btnPermission.mandatoryFinish?'无权限执行此操作':''}}">结单</button>
                                        <button class="btn btn-operate m-r-xs" ng-click="BarcodeInbound(item)"
                                            ng-disabled="(item.state != 0 && item.state != 1)  || !btnPermission.BarcodeBeginningInIn" translate translate-attr-title="{{!btnPermission.BarcodeBeginningInIn?'无权限执行此操作':''}}">条码入库</button>
                                    </div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="dataList.length > 0" ng-style="tbStyle.scrollLeft">
                        <table class="table-fixed border-none" width="{{tableConfig.scrollWidth}}">
                            <tbody>
                            <tr ng-repeat="item in dataList track by $index" ng-class="{'row-selected': $index === markInfo.curRow}"
                                ng-click="selectRow($index)">
                                <td class="spill-dots" ng-repeat="itemCol in tableConfig.tableCol track by $index" width="{{itemCol.width}}"
                                    ng-show="!!itemCol.isShow && !itemCol.isFixed"
                                    >
                                    <span ng-if="!itemCol.clickFn && itemCol.type !== 'operate' && !itemCol.isEN" title="{{item[itemCol.dataField]}}">{{item[itemCol.dataField]}}</span>
                                    <span ng-if="itemCol.isEN" translate translate-attr-title="{{item[itemCol.dataField]}}">{{item[itemCol.dataField]}}</span>
                                    <a class="btn-operate m-r-xs" ng-click="tdClick($parent.$parent.$index, item, itemCol.clickFn)" ng-if="!!itemCol.clickFn">
                                        {{item[itemCol.dataField]}}
                                    </a>
                                    <div class="font-0" ng-if="itemCol.type === 'operate'">
                                        <button type="button" class="btn btn-operate m-r-xs" ng-click="printBill(item)"
                                                ng-disabled="!btnPermission.beginningInPrint" title="{{!btnPermission.beginningInPrint?'无权限执行此操作':''}}">打印</button>
                                        <button class="btn btn-operate m-r-xs" ng-click="inbound(item)" ng-if="curOrg.isBarcode === 0"
                                                ng-disabled="item.state !== 0 || !btnPermission.beginningInIn" title="{{!btnPermission.beginningInIn?'无权限执行此操作':''}}">入库</button>
                                        <button type="button" class="btn btn-operate m-r-xs" ng-click="mandatoryFinish(item.billNo)"
                                                ng-disabled="item.state == 2 || item.state == 3 || !btnPermission.mandatoryFinish" title="{{!btnPermission.mandatoryFinish?'无权限执行此操作':''}}">结单</button>
                                    </div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="dataList.length === 0" translate>暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area page-bar wrapper-y-sm clearfix">
                <div yb-page-info ng-model="pageInfo" yb-refresh="search()"></div>
            </div>
        </div>
        <div tab heading="导入" active="activeFlag[1]" ng-if="activeFlag[1]">
            <div class="main-area d-t-35 d-b-60">
                <form name="form" class="main-wrap form-horizontal single-col p-t clearfix" novalidate>
                    <div class="form-group m-b-sm">
                        <label class="col-xs-2 control-label"><i>*</i><span translate>仓库编号</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <div yb-form-clear ng-model="detailInfo.warehouseCode" select-obj="selectWarehouse()"
                                 clear-form="clearWarehouse()" tips-name="仓库" form-require="true"></div>
                        </div>
                        <div class="col-xs-4 msg-block" ng-if="!detailInfo.warehouseCode && submitted">
                            <div class="error-msg">
                                <i class="yb-icon ico-times-circular"></i><span translate>请选择仓库</span>
                            </div>
                        </div>
                    </div>

                    <div class="form-group m-b-sm">
                        <label class="col-xs-2 control-label"><span translate>库区编号</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <div yb-form-clear ng-model="detailInfo.areaCode" select-obj="selectArea()"
                                 clear-form="clearArea()" tips-name="库区"></div>
                        </div>
                    </div>
                    <div class="form-group m-b-sm">
                        <label class="col-xs-2 control-label"><span translate>sap库区编码</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" class="form-control" ng-model="detailInfo.sapCode" maxlength="20">
                        </div>
                    </div>
                    <div class="form-group m-b-sm">
                        <label class="col-xs-2 control-label"><span translate>国家和地区</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <div dealer-dictionary-selector ng-model="detailInfo.country" sel-key="country">
                                <input type="text" class="form-control light-bg" ng-model="detailInfo.country" translate-attr-placeholder="请选择" readonly yb-focus>
                            </div>
                        </div>
                    </div>
                    <div class="form-group m-b-none">
                        <label class="col-xs-2 control-label"><span translate>下载模板</span>：</label>
                        <label class="col-xs-5 control-label p-l-n text-left clearfix">
                            <span class="btn btn-operate col-xs-1 text-left"
                                  yb-download ng-click="downloadModule()" download-url="templateReqUrl" download-param="condition" translate>
                                  下载
                            </span>
                        </label>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><i>*</i><span translate>选择文件</span>：</label>
                        <label class="col-xs-5 control-label p-l-n text-left clearfix">
                            <span class="btn btn-operate col-xs-1 text-left" ngf-select ng-model="file" name="file"
                                  ngf-change="checkFileType(file)">
                                  <span translate>添加文件</span>
                            </span>
                            <span class="m-l-sm col-xs-8 spill-dots" title="{{file.name}}">{{file.name}}</span>
                        </label>

                        <div class="col-xs-4 msg-block" ng-show="fileErr">
                            <div class="error-msg">
                                <i class="yb-icon ico-times-circular"></i>请选择 xls 格式的文件
                            </div>
                        </div>
                    </div>
                    <div class="form-group m-t-n" ng-if="showErrList">
                        <label class="control-label col-xs-2">错误信息：</label>
                        <ul class="import-error col-xs-10">
                            <li ng-repeat="item in importErrList track by $index" class="m-b-xs">
                                <div class="pos-a">第<span class="err-row warn-color">{{item.errorRow}}</span>行：</div>
                                <div class="err-msg">{{item.remark}}</div>
                            </li>
                        </ul>
                    </div>
                    <div class="form-group m-t-n-sm" ng-if="showErrMsg">
                        <label class="control-label col-xs-2">错误信息：</label>
                        <label class="col-xs-5 control-label p-l-n text-left danger-color clearfix">
                            {{importErrMsg}}
                        </label>
                    </div>
                    <div class="form-group save-bar m-b-none">
                        <label class="col-xs-2 control-label"></label>
                        <div class="col-xs-5 wrapper-none">
                            <button type="button" class="btn btn-primary m-r-sm" ng-disabled="disableImport" ng-click="saveData(form.$valid, file)" translate>
                                导入
                            </button>
                            <button type="button" class="btn btn-default" ng-click="changeTab(0)" translate>取消</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div tab heading="详情" active="activeFlag[2]" ng-if="activeFlag[2]">
            <div class="m-t-sm form-up-tb clearfix">
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100"><span translate>入库单号</span>：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{detailInfo.billNo || '-'}}">
                        {{detailInfo.billNo || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100"><span translate>仓库编号</span>：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{detailInfo.inLocation || '-'}}">
                        {{detailInfo.inLocation || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100"><span translate>入库状态</span>：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{detailInfo.stateDesc || '-'}}">
                        {{detailInfo.stateDesc || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100"><span translate>制单人</span>：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{detailInfo.createName || '-'}}">
                        {{detailInfo.createName || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100"><span translate>制单部门</span>：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{detailInfo.dept || '-'}}">
                        {{detailInfo.dept || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100"><span translate>制单时间</span>：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{(detailInfo.createDate | YbDate:'yyyy-MM-dd HH:mm:ss') || '-'}}">
                        {{(detailInfo.createDate | YbDate:'yyyy-MM-dd HH:mm:ss') || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100"><span translate>库区</span>：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{detailInfo.areaCode || '-'}}">
                        {{detailInfo.areaCode || "-"}}
                    </div>
                </div>
            </div>
            <div class="panel-bar clearfix">
                <div class="pull-left">
                    <i></i><span translate>零件信息</span>
                </div>
            </div>
            <div class="main-area" style="bottom: 110px;" ng-style="{'top': isEN?'170px':'140px'}">
                <div yb-table-fixed class="table-fixed-wrap">
                    <div class="th-scroll-x">
                        <table class="table-fixed border-none" width="{{detailTbConf.scrollWidth}}">
                            <thead>
                            <tr>
                                <th width="60" class="border-l-none" translate>
                                    操作
                                </th>
                                <th ng-repeat="itemCol in detailTbConf.tableCol track by $index" width="{{itemCol.width}}">
                                    <div yb-thead-operate ng-model="itemCol" target-width="detailTbConf.scrollWidth"></div>
                                </th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="materielList.length > 0">
                        <table class="table-fixed border-none" width="{{detailTbConf.scrollWidth}}">
                            <tbody>
                            <tr ng-repeat="item in materielList track by $index">
                                <td width="60" class="font-0">
                                    <button class="btn btn-operate" ng-click="mandatoryFinish(detailInfo.billNo, detailInfo.id, item.materialsNo)"
                                            ng-disabled="detailInfo.state == 2 || detailInfo.state == 3 || item.state == 2 || item.state == 3 || !btnPermission.mandatoryFinish" translate translate-attr-title="{{!btnPermission.mandatoryFinish?'无权限执行此操作':''}}">结单</button>
                                </td>
                                <td ng-repeat="itemCol in detailTbConf.tableCol track by $index" width="{{itemCol.width}}"
                                    class="spill-dots" >
                                    <span ng-if="!itemCol.isEN" title="{{item[itemCol.dataField]}}">{{item[itemCol.dataField]}}</span>  
                                    <span ng-if="itemCol.isEN" translate translate-attr-title="{{item[itemCol.dataField]}}">{{item[itemCol.dataField]}}</span>  
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="materielList.length === 0" translate>暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area page-bar wrapper-y-sm d-b-60 clearfix">
                <!--<div yb-page-info ng-model="materielPageInfo" yb-refresh="searchMateriel()"></div>-->
            </div>
            <div class="bottom-area btn-bar text-center border-t clearfix">
                <button type="button" class="btn btn-primary m-r-sm" ng-click="mandatoryFinish(detailInfo.billNo, detailInfo.id)"
                        ng-disabled="detailInfo.state == 2 || detailInfo.state == 3 || !btnPermission.mandatoryFinish" translate translate-attr-title="{{!btnPermission.mandatoryFinish?'无权限执行此操作':''}}">结单</button>
                <button type="button" class="btn btn-default m-r-sm" ng-click="cancel()" translate>返回</button>
            </div>
        </div>
        <div tab heading="入库" active="activeFlag[3]" ng-if="activeFlag[3]">
            <div class="m-t-sm form-up-tb clearfix">
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100"><span translate>入库单号</span>：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{detailInfo.billNo || '-'}}">
                        {{detailInfo.billNo || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100"><span translate>仓库编号</span>：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{detailInfo.inLocation || '-'}}">
                        {{detailInfo.inLocation || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100"><span translate>入库状态</span>：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{detailInfo.stateDesc || '-'}}">
                        {{detailInfo.stateDesc || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100"><span translate>制单人</span>：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{detailInfo.createName || '-'}}">
                        {{detailInfo.createName || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100"><span translate>制单部门</span>：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{detailInfo.dept || '-'}}">
                        {{detailInfo.dept || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100"><span translate>制单时间</span>：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{(detailInfo.createDate | YbDate) || '-'}}">
                        {{(detailInfo.createDate | YbDate) || "-"}}
                    </div>
                </div>
            </div>
            <div class="panel-bar clearfix">
                <div class="pull-left">
                    <i></i><span translate>零件信息</span>
                </div>
            </div>
            <div class="main-area" style="top:140px;bottom: 110px;">
                <div yb-table-fixed class="table-fixed-wrap">
                    <div class="th-scroll-x">
                        <table class="table-fixed border-none" width="{{inTbConf.scrollWidth}}">
                            <thead>
                            <tr>
                                <th ng-repeat="itemCol in inTbConf.tableCol track by $index" width="{{itemCol.width}}">
                                    <div yb-thead-operate ng-model="itemCol" target-width="inTbConf.scrollWidth"></div>
                                </th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="materielList.length > 0">
                        <table class="table-fixed border-none" width="{{inTbConf.scrollWidth}}">
                            <tbody>
                            <tr ng-repeat="item in materielList track by $index">
                                <td ng-repeat="itemCol in inTbConf.tableCol track by $index" width="{{itemCol.width}}"
                                    ng-class="{'wrapper-none': itemCol.inputType === 'func'}">
                                    <div class="spill-dots" ng-if="!itemCol.input || item.state == 2 || item.state == 3" title="{{item[itemCol.dataField]}}">
                                        {{item[itemCol.dataField]}}
                                    </div>
                                    <div ng-if="!!itemCol.input && itemCol.inputType === 'func' && (item.state == 0 || item.state == 1)" class="td-edit pos-r">
                                    <div yb-form-clear class="td-edit" ng-model="item[itemCol.dataField]"
                                         select-obj="selDepot(item)"
                                         clear-form="clearDepot(item)" tips-name="储位"
                                         ng-if="!!itemCol.input && itemCol.inputType === 'func' && (item.state == 0 || item.state == 1)"
                                         title="{{item[itemCol.dataField]}}" ng-class="{'error': !!item.locationErr}"></div>
                                        <div class="pos-a tool-tips" ng-if="!!item.locationErr && !item.locationCode">
                                            <i class="triangle"></i>
                                            <div class="msg" translate>储位不可为空</div>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="materielList.length === 0" translate>暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area page-bar wrapper-y-sm d-b-60 clearfix">
                <!--<div yb-page-info ng-model="materielPageInfo" yb-refresh="searchMateriel()"></div>-->
            </div>
            <div class="bottom-area btn-bar text-center clearfix">
                <button type="button" class="btn btn-primary m-r-sm" ng-click="inboundSubmit()" translate>确认入库</button>
                <button type="button" class="btn btn-default" ng-click="cancel()" translate>取消</button>
            </div>
        </div>
    </div>
</div>